(function (jQuery) {
    //登录用户名状态
    let oUser=JSON.parse(sessionStorage.getItem("sasauserinfo"))
    $(function () {
        if(oUser){
            $("#txt").html("欢迎您:"+oUser.u_name);
            $(".Page_header p").css("display","none");
            $("#close").css("display","block")
            $("#close").css("float","right")
            $("#close").css("margin-left","10px")

            $("#emtittle").css("display","none")


            $("#close").on("click",function(){
                sessionStorage.removeItem("sasauserinfo");
                window.location="index1.html";
                $(".Page_header>p").css("display","block");
                $(this).css("display","none")
            })
        }

    })



    $(function () {
        $.ajax({
            url : "../../server/getlist.php",
        }).then(function (res) {
            let str=``
            res.forEach((ele,index)=>{
                str +=`
                    <a href="page.html?id=${ele.gid}">   
                        <div class="goods"><img src="${ele.img[0]}" alt="">
                            <div class="title">
                                <p>名称:${ele.goodsName}</p>
                                <p>价格:${ele.price}</p>
                                <button>立即购买</button>
                            </div>
                        </div>
                    </a>`
            })

            $(".obox").html(str);
        })
    })
})(jQuery)